# Chapter 13. The gawk Scripting Language

#### Contents:

Conceptual Overview
Command-Line Syntax
Patterns and Procedures
gawk System Variables
Operators
Variable and Array Assignments
Group Listing of gawk Commands
Alphabetical Summary of Commands

gawk is the GNU version of awk, a powerful pattern-matching program for processing text files that may be composed of fixed or variable length records separated by some delineator (by default, a newline character). gawk may be used from the command line or in gawk scripts. Normally you should be able to invoke this utility using either awk or gawk on the shell command line.

This chapter presents the following topics:

- Conceptual overview

- Command-line syntax

- Patterns and procedures

- System variables

- Operators

- Variable and array assignment

- Group listing of commands

- Alphabetical summary of commands

For more information, see the O'Reilly book sed & awk, 2d ed., by Dale Dougherty and Arnold Robbins.

## 13.1. Conceptual Overview

With gawk, you can:

- Conveniently process a text file as though it were made up of records and fields in a textual database.

- Use variables to change the database.

- Execute shell commands from a script.

- Perform arithmetic and string operations.

- Use programming constructs such as loops and conditionals.

- Define your own functions.

- Process the result of shell commands.

- Process command-line arguments more gracefully.

- Produce formatted reports.

Copyright © 2001 O'Reilly & Associates. All rights reserved.